<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../../vue文件/vue.js"></script>
</head>
<body>
    <div id="app">
        <ul>
            <li v-for='count in 10' @click='change(count)' :class='flag==count?"bg":""'>
                   {{count}}
            </li>
        </ul>
    </div>
</body>
<script>
    let vm = new Vue({
        el:'#app',
        data:{
            flag:1
        },
        methods:{
            change(index){
                this.flag = index;
            }
        }
    })
</script>
<style>
    .bg{
        background-color: #cccccc;
    }
</style>
</html>